fn main() {
    println!("Hello, world!");

    let mut st = String::from("Hello World");
    println!("{}", st);

    let mon = first_word(&st);
    println!("{}", mon);
    println!("{}", st);
    st.clear();
    println!("After clear is :{}", st);
    println!("The first word is {}", mon);
}

fn first_word(s: &String)->usize{
    let bs = s.as_bytes();

    for (i, &item) in bs.iter().enumerate() {
        if item == b' '{
            return i;
        }
    }

    return s.len();
}
